<link rel="stylesheet" href="/css/Module_searchresult/history.css">
<script src="/js/Module_searchresult/history.js"></script>

<?php if(count($overlayImage)==0 && count($researchs)==0):?>

    "No data found"
<?php else:?>
<div align="right">

    <table cellspacing="0" cellpadding="0">
    <tr>
        <td class="tdtool"><a id="selectAllresult_History" style="cursor: pointer;font-family: 'calibri';font-size: 7pt" >Select All</a></td>

    <td class="tdtool"><a id="unselectAllresult_History" style="cursor: pointer;font-family: 'calibri';font-size: 7pt">Unselect All</a></td>

    <td class="tdtool"><a id="clear_History" style="cursor: pointer;font-family: 'calibri';font-size: 7pt;">Clear History</a></td>
<td class="tdtool"><a id="locationattributereportbtn_history" style="cursor: pointer;font-family: 'calibri';font-size: 7pt;" onclick="showAttributeReportAllLocation_history();" >Attribute Report</a></td>
    <td><a id="downloadexceldata_History" style="cursor: pointer;font-family: 'calibri';font-size: 7pt;" onclick="SaveSearchData();">Download Data </a></td>
    </tr>
   </table>
</div>
<?php endif ?>


<?php if(count($overlayImage)>0):?>





<?php foreach($overlayImage as $overlay):?>
    <div id="divsearchdata_History" style="  height: 50px;" align="left">

    <table class="Search_Results_History"  name="Result_Table_History" id ="<?php echo $overlay->getId()?>" onclick="tbvalue(this)">
        <tr>
            <td width="25px">
                <input type="checkbox" name="selectResult_History" id="selectResult_History_overlay_<?php echo $overlay->getId()?>" value="<?php echo $overlay->getId()?>" onclick="flgChk_History=true;setFilter_History(2)"/>
            </td>
            <td align="left">
                <?php echo $overlay->getOverlaytitle(); ?>
            </td>

        </tr>
</table>
</div>
<p>
    <?php endforeach?>
<?php echo "Overlay Images Count: ".(count($overlayImage))?>
<?php endif?>




<?php if(count($researchs)>0):?>

<?php $tmp="" ?>



<?php foreach($researchs as $research):?>
<div id="divsearchdata_History" style="  height: 120px;">

    <table class="Search_Results_History"  name="Result_Table_History" id ="<?php echo $research->getId()?>">
        <tr>
            <td>
                <input type="checkbox" name="selectResult_History" id="selectResult_History_species_<?php echo $research->getId()?>" value="<?php echo $research->getId()?>" onclick="flgChk_History=true;setFilter_History(2)"/>
            </td>
            <td colspan="2" >
                <table width="100%"><tr><td><?php echo "<span class='title'>".$research->Species["species"]."</span>"?></td><td align="right"><a href="#" onclick="window.open('http://en.wikipedia.org/wiki/<?php echo $research->Species["species"] ?>')"><img width="24px" src='/images/wiki.png'/></a></td></tr></table>
            </td>
        </tr>
        <tr>
            <td>

            </td>
            <td>
                <?php $t= '"'. $research->Observationdepth->Observation["location"] .'"' ?>
                 <?php echo "<span class='caption'>Location: </span> ". "<a onclick='showattributereport(".$t .");'><span class='val' name='searchLocationName'>".$research->Observationdepth->Observation["location"]."</span></a>"?>
            </td>
            <td>
                <?php if ($research->Observationdepth["observationdepth"]>0):?>
                <?php echo "<span class='caption'>Depth: </span> ". "<span class='val'>".$research->Observationdepth["observationdepth"].$research->Observationdepth->Unit["unit"]."</span>"?>
                <?php else: ?>
                <?php echo "<span class='caption'>Depth: </span> "?>
                <?php endif ?>
            </td>

        </tr>


        <tr>
            <td>

            </td>
            <td>
                <?php if ($research->getQuantity()>0):?>
                <?php echo "<span class='caption'>Quantity: </span> ". "<span class='val'>".$research->getQuantity()."</span>"?>
                <?php else: ?>
                <?php echo "<span class='caption'>Quantity: </span> "?>
                <?php endif ?>
            </td>
            <td>
                <?php //echo "<span class='caption'>Unit: </span> ". "<span class='val'>".$research->Species->Unit["unit"]."</span>"?>
            </td>

        </tr>
        <tr>
            <td>

            </td>
            <td>
                <?php echo "<span class='caption'>Contributor:</span> ". "<span class='val'>".$research->Observationdepth->Observation->Research->Entity["firstname"]."</span>"?>
            </td>
            <td>
                <span class='caption'>Observation Date:</span>                <?php echo  "<span class='val'>".$research->Observationdepth->Observation["observationdate"]."</span>"?>
            </td>

        </tr>
        <tr>
            <td>

            </td>
            <td >
                <?php echo "<span class='caption'>Tag:</span> ". "<span class='val'>".$research["tag"]."</span>"?>
            </td>
            <td align="right">
                    <?php echo "<a id='atrb' style='cursor: pointer;font-family: calibri;font-size: 7pt' onclick='showattributereport(".$t .");'>Attribute Details</a>"?>
            </td>


        </tr>

</table>
</div>
<p>
    <?php endforeach?>
<?php echo "Species data count: ". count($researchs)?>
<?php endif?>


    <?php if(count($researchsattribute)>0):?>

<?php $tmp="" ?>


<?php foreach($researchsattribute as $r): ?>

<div id="divsearchdata_History" style="  height: 50px;">

    <table class="Search_Results_History"  name="Result_Table_History" id ="<?php echo $r->getId()?>" onclick="tbvalue(this)">

        <tr>
            <td>
<input type="checkbox" name="selectResult_History" id="selectResult_History_nonspecies_<?php echo $r->getId()?>" value="<?php echo $r->getId()?>" onclick="flgChk_History=true;setFilter_History(2)"/>
            </td>
            <td>
                <?php $t= '"'. $r->Observation["location"] .'"' ?>
                 <?php echo "<span class='title'>Location: </span> ". "<a onclick='showattributereport(".$t .");'><span class='title' name='searchLocationName'>".$r->Observation["location"]."</span></a>"?>
            </td>
            <td>
                <?php if ($r["observationdepth"]>0):?>
                <?php echo "<span class='caption'>Depth: </span> ". "<span class='val'>".$r["observationdepth"].$r->Unit["unit"]."</span>"?>
                <?php else: ?>
                <?php echo "<span class='caption'>Depth: </span> "?>
                <?php endif ?>
            </td>

        </tr>

        <tr>
            <td>

            </td>
            <td >
                <?php echo "<span class='caption'>Contributor:</span> ". "<span class='val'>".$r->Observation->Research->Entity["firstname"]."</span>"?>
            </td>
            <td>
                <span class='caption'>Observation Date:</span>                <?php echo  "<span class='val'>".$r->Observation["observationdate"]."</span>"?>
                </td>


        </tr>
</table>
</div>
<p>
    <?php endforeach?>
    <?php echo "Non Biological Data Count: ".(count($researchsattribute))?>
<?php endif?>